package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.Mapper;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface WeiboMapper {

     //@Insert("insert into weibo(content,created,user_id) values(#{content},#{created},#{userId})")
     int insertWeibo(Weibo weibo);

     //@Delete("delete from weibo where id=#{id}")
     int deleteWeibo(int id);

     //@Insert("update weibo set content=#{content},created=#{created},user_id=#{userId} where id=#{id}")
     int updateWeibo(Weibo weibo);

     //@Select("select id,content,created,user_id userId from weibo where id=#{id}")
     Weibo selectWeibo(int id);

     //查询多条数据
//     @Select("select id,content,created,user_id userId from weibo where user_id=#{uid}")
     List<Weibo> selectWeibos(Long uid);

     //@Select("select content,created from weibo where id=#{id}")
     WeiboVO1 selectWeiboVO1(int id);

     //@Select("select u.username,w.content,w.created from weibo w,user u where w.user_id=u.id and u.id=#{uid}")
     List<WeiboVO2> selectWeiboVO2(Long uid);

     //动态修改
     int updateDynamicWeibo(Weibo weibo);

     //动态删除
     int deleteDynamicWeibo(ArrayList<Long> ids );

     //动态删除数组形式
     int deleteDynamicWeibo1(Long[] ids);

     //统计weibo表里有多少条数据
     int selectCount();

     ResultmapVO1 selectById(Long id);

     ResultMapVO2 selectById2(Long uid);

     ResultMapVO3 selectById3(Long wid);
}
